<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>安全图片查看器 - 密码保护</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html, body {
            height: 100%;
            width: 100%;
            color: #fff;
            min-height: 100vh;
        }

        #container {
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>

<div id="container"></div>

<script type="text/javascript">
    window._AMapSecurityConfig = {
        serviceHost: "http://47.120.15.51:80/_AMapService",
    };
</script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=2.0&key=882baae2abc6fe7cf494fed9017fec6f"></script>
<script>
    window.onload = function () {
        const previewUrl = getUrlParam(window.location.href, 'previewUrl');
        initializeViewer(previewUrl);
    }

    function getUrlParam(url, paramName) {
        let queryString = '';
        try {
            const urlObj = new URL(url);
            queryString = urlObj.search;
        } catch (e) {
            // 如果不是标准 URL，但以 ? 开头，当作查询字符串处理
            queryString = url.startsWith('?') ? url : '?' + url;
        }
        const searchParams = new URLSearchParams(queryString);
        return searchParams.get(paramName); // 存在则返回值，否则返回 null
    }

    // 初始化OpenSeadragon查看器
    function initializeViewer(previewUrl) {
        //地图初始化应该在地图容器div已经添加到DOM树之后
        var map = new AMap.Map("container", {
            viewMode: '2D',
            zoom: 12,
        });
    }
</script>
</body>
</html>